/*
 * @description: 
 * @Date: 2023-05-24 13:39:06
 * @example: 
 * @params: 
 */
import axios from "axios";
import { useUserStore } from '@/store/index.js'
const UserStore = useUserStore()
const instance = axios.create({
    timeout:6000,
    baseURL:""
})


instance.interceptors.request.use((config)=>{
    
    const token = window.sessionStorage.getItem('token')
    // const TenantCode = UserStore.USERINFO
    // if( token ) {
    //     const headers = {
    //         Authorization: `Bearer ${token}`,
    //         'x-tenant-id' : TenantCode
    //     }
    //     return {...config, headers:{...headers}}
    // }
    return config
   
})


instance.interceptors.response.use((response)=>{
    return response.data  // 2xx 范围内的状态码都会触发该函数。
},(error) => {
    return Promise.reject(error)
}
)



export default instance
